// pages/center/editAddress/editAddress.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    address: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.on('acceptDataFromCenter', (data) => {
      this.setData({ address: data.address })
    })
  },

  onInput(e) {
    this.setData({ address: e.detail.value })
  },

  saveAddress() {
    const eventChannel = this.getOpenerEventChannel()
    eventChannel.emit('updateAddress', { address: this.data.address })
    wx.navigateBack()
  }
})